home *** CD-ROM | disk | FTP | other *** search
- ;;
- ;; aPLib compression library - the smaller the better :)
- ;;
- ;; DOS32 example
- ;;
- ;; Copyright (c) 1998-2000 by Joergen Ibsen / Jibz
- ;; All Rights Reserved
- ;;
-
- .386p
- .model flat
-
- locals
- jumps
-
- .stack 256
-
- .data?
-
- dest db 128 dup (?)
- check db 128 dup (?)
- workmem db 640*1024 dup (?)
-
- .data
-
- src db 'This is just a simple little test, to see if aPLib works!!!$'
- srclen dd ($-src)
-
- pcktxt db 'Packing...', 0dh, 0ah, '$'
-
- .code
-
- extrn _aP_pack : near
- extrn _aP_depack_asm : near
- extrn _aP_depack_asm_fast : near
-
- aplib_asm_test:
- ; compress src -> dest
- push offset callback ; no callback, hence NULL
- push offset workmem ; 1mb of workmem
- push [srclen] ; length
- push offset dest ; destination
- push offset src ; source
- call _aP_pack ; compress
- add esp, 5*4 ; adjust stack (function is cdecl)
-
- ; decompress dest -> check
- push offset check ; destination
- push offset dest ; source
- call _aP_depack_asm_fast ; decompress
- add esp, 2*4 ; adjust stack (function is cdecl)
-
- ; print out check to verify
- mov edx, offset check ; print result
- mov ah, 09h
- int 21h
-
- ; exit to dos
- c_done:
- mov ax, 4C00h
- int 21h
-
- callback:
- push ebp
- mov ebp, esp
- pushad
-
- ; print out 'Packing...' just to show it works
- mov edx, offset pcktxt
- mov ah, 09h
- int 21h
-
- popad
- pop ebp
- mov eax, 1 ; continue packing
- ret
-
- END aplib_asm_test
-